Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(builder): use find-cache-dir to support customizing cache directory location #196

Conversation

kallevmercury
Copy link
Contributor

@kallevmercury kallevmercury commented Dec 17, 2024

Add support for customizing the cache directory using the CACHE_DIR environment variable via https://www.npmjs.com/package/find-cache-dir.

Resolves: #197

Copy link

netlify bot commented Dec 17, 2024

Deploy Preview for storybook-rsbuild canceled.

Name Link
🔨 Latest commit 1951d2e
🔍 Latest deploy log https://app.netlify.com/sites/storybook-rsbuild/deploys/6761f70b4c44880008682353

@kallevmercury kallevmercury marked this pull request as ready for review December 17, 2024 22:15
@kallevmercury kallevmercury changed the title feat(builder): use find-cache-dir to support customizing directory location feat(builder): use find-cache-dir to support customizing cache directory location Dec 17, 2024
@stephenjudkins
Copy link

Thank you!

@fi3ework
Copy link
Member

fi3ework commented Dec 18, 2024

Thank you. Generally LGTM, I'm wondering do we need to document this out, but I found it's also not documented in Storybook's site.

@kallevmercury
Copy link
Contributor Author

Thank you. Generally LGTM, I'm wondering do we need to document this out, but I found it's also not documented in Storybook's site.

@fi3ework Thank you for checking this so quickly; let me know if there are any further changes you'd like to see for the contribution. I couldn't find the cache dir env variable documented on the main Storybook configuration either besides the Github issues and the Vite builder source code such as here: https://github.com/storybookjs/storybook/blob/abe4c8813017be23b96b3a4faee11344bd2d6163/code/builders/builder-vite/src/plugins/external-globals-plugin.ts#L55

? // TODO: This is a hard code cache dir, as Rspack doesn't support virtual modules now.
// Remove this when Rspack supports virtual modules.
(findCacheDirectory({
name: 'storybook-rsbuild-builder',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it on purpose to change the cache dir from .cache/storybook/storybook-rsbuild-builder to .cache/storybook-rsbuild-builder here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine to place it in either location. I can't recall why I initially put it inside ./storybook—maybe it was just an unconscious choice. I'm glad to see we're now aligned with Storybook. Thank you.

@fi3ework
Copy link
Member

Thank you. Generally LGTM, I'm wondering do we need to document this out, but I found it's also not documented in Storybook's site.

@fi3ework Thank you for checking this so quickly; let me know if there are any further changes you'd like to see for the contribution. I couldn't find the cache dir env variable documented on the main Storybook configuration either besides the Github issues and the Vite builder source code such as here: storybookjs/storybook@abe4c88/code/builders/builder-vite/src/plugins/external-globals-plugin.ts#L55

Since the solution could be found in Storybook, I think we don't need to add documentation for now.

@fi3ework fi3ework merged commit ab5b798 into rspack-contrib:main Dec 19, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants